/**
 * “前台管理”相关接口
 */
import request from '@/utils/request'

export default {
  //category.vue start
  getCategory(params){
    const data ={
      showInNav: params.showInNav,
      display: params.display
    };
    return request({
      url: 'shopCategory/infos',
      method: 'post',
      data
    })
  },
  saveCategory(categoryInfo,attributeInfo){
    const data = {
      categoryInfo: categoryInfo,
      attributeInfo: attributeInfo
    };
    return request({
      url: 'shopCategory/save',
      method: 'post',
      data
    })
  },
  updateCategory(categoryInfo,attributeInfo){
    const data = {
      categoryInfo: categoryInfo,
      attributeInfo: attributeInfo
    };
    return request({
      url: 'shopCategory/update',
      method: 'post',
      data
    })
  },
  deleteCategory(params){
    const data = params;
    return request({
      url: 'shopCategory/delete',
      method: 'post',
      data
    })
  },
  getAttributeInfos(params){
    const data = params;
    return request({
      url: 'shopAttribute/data/list',
      method: 'post',
      data
    })
  },
  //category.vue end
  /** 公共接口功能--开始 **/
  getNewGoodsDataList(params, page, size){
    /** 分页获取商品数据 **/
    const data = {
      shopGoods: params
    }
    return request({
      url: 'shopGoods/newGoodsListByPage?page='+page+'&size='+size,
      method: 'post',
      data
    })
  },
  getHotGoodsDataList(params, page, size){
    /** 分页获取商品数据 **/
    const data = {
      shopGoods: params
    }
    return request({
      url: 'shopGoods/hotGoodsListByPage?page='+page+'&size='+size,
      method: 'post',
      data
    })
  },
  /** 修改商品推荐状态 **/
  updateGoodsRecommend(params){
    /** 分页获取商品数据 **/
    const data = params;
    return request({
      url: 'shopGoods/data/updateById',
      method: 'post',
      data
    })
  },
  /** 获取商品详情 **/
  initShopgoodsList(params){
    /** 获取商品详情 **/
    let data = {
      goodsId:params.goodsId,
      catId:params.catId
    }
    return request({
      url: '/shopGoods/goodsInfoByIdPro',
      method: 'post',
      data
    })
  },
  /** 公共接口功能--开始 **/
  /** homeManage.vue--开始 **/
  initHomePage(params, page, size){
    const data = params;
    return request({
      url: 'shopPhoto/homeListByPage?page='+page+'&size='+size,
      method: 'post',
      data
    })
  },
  updateHomePhotoStatus(params){
    const data = params;
    return request({
      url: 'shopPhoto/data/updateById',
      method: 'post',
      data
    })
  },
  addHomePhotoStatus(params){
    const data = params;
    return request({
      url: 'shopPhoto/data/insert',
      method: 'post',
      data
    })
  },
  deleteHomePhotoById(params){
    const data = params;
    return request({
      url: 'shopPhoto/data/delete',
      method: 'post',
      data
    })
  },
  /** 走马灯预览 **/
  previewCarousel(){
    return request({
      url: 'shopPhoto/previewCarousel',
      method: 'post',
    })
  }
  /** homeManage.vue--结束 **/
}
